package com.cj.webapp.account.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.cj.webapp.account.pojo.ConstantParamter;
import com.cj.webapp.account.pojo.InvestBdDto;
import com.cj.webapp.common.sign.SignVerifyHandle;
import com.cj.webapp.common.utils.MapDetail;
import com.cj.webapp.common.utils.UtilDatetime;
import com.cj.webapp.common.utils.http.HttpsUtil;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * 获取认购标的列表
 * Created by dell on 2018/1/22.
 */
//@WebServlet(name = "RechargeServlet")
public class InvestBdListServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");
        //HttpSession session = request.getSession();

        HttpsUtil httpsUtil=new HttpsUtil();
        List<InvestBdDto> listRes=new ArrayList<>();

        String urlString= ConstantParamter.DIRECT_WAY_URL;
        Map<String,Object> map=new HashMap<>();
        map.put("token",MapDetail.resMap.get("token").toString());
        map.put("source",MapDetail.resMap.get("source").toString());
        listRes=httpsUtil.sendInvestBdList(map,urlString);
        request.setAttribute("list",listRes);

        request.getRequestDispatcher("/page/mobile/invest/investBdList.jsp").forward(request,response);

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
                 doPost(request,response);
    }



}
